home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / gfx / vtdevel3.lha / Include / libraries / iffparse.i < prev    next >
Text File  |  1992-09-24  |  8KB  |  224 lines

  1.     IFND LIBRARIES_IFFPARSE_I
  2. LIBRARIES_IFFPARSE_I    SET    1
  3. **
  4. **    $VER: iffparse.i 39.1 (01.06.92)
  5. **    Includes Release 39.108
  6. **
  7. **    iffparse.library structures and constants
  8. **
  9. **    (C) Copyright 1989-1992 Commodore-Amiga Inc.
  10. **    (C) Copyright 1989-1990 Stuart Ferguson and Leo L. Schwab
  11. **    All Rights Reserved
  12. **
  13.  
  14. ;---------------------------------------------------------------------------
  15.  
  16.     IFND EXEC_TYPES_I
  17.     INCLUDE "exec/types.i"
  18.     ENDC
  19.  
  20.     IFND EXEC_LISTS_I
  21.     INCLUDE "exec/lists.i"
  22.     ENDC
  23.  
  24.     IFND EXEC_PORTS_I
  25.     INCLUDE "exec/ports.i"
  26.     ENDC
  27.  
  28.     IFND DEVICES_CLIPBOARD_I
  29.     INCLUDE "devices/clipboard.i"
  30.     ENDC
  31.  
  32. ;---------------------------------------------------------------------------
  33.  
  34. ; Structure associated with an active IFF stream.
  35. ; "iff_Stream" is a value used by the client's read/write/seek functions -
  36. ; it will not be accessed by the library itself and can have any value
  37. ; (could even be a pointer or a BPTR).
  38. ;
  39. ; This structure can only be allocated by iffparse.library
  40. ;
  41.    STRUCTURE IFFHandle,0
  42.         ULONG iff_Stream
  43.         ULONG iff_Flags
  44.         LONG  iff_Depth   ; Depth of context stack.
  45.    LABEL iff_SIZEOF
  46.  
  47. ; Bit masks for "iff_Flags" field
  48. IFFF_READ       equ 0                     ; read mode - default
  49. IFFF_WRITE      equ 1                     ; write mode
  50. IFFF_RWBITS     equ IFFF_READ!IFFF_WRITE  ; read/write bits
  51. IFFF_FSEEK      equ 1<<1                  ; forward seek only
  52. IFFF_RSEEK      equ 1<<2                  ; random seek
  53. IFFF_RESERVED   equ $FFFF0000             ; Don't touch these bits
  54.  
  55. ;---------------------------------------------------------------------------
  56.  
  57. ; When the library calls your stream handler, you'll be passed a pointer
  58. ; to this structure as the "message packet".
  59. ; NOTE:  ASSEMBLY PREFIX (isc_) DIFFERENT FROM C PREFIX (sc_).
  60. ;
  61.    STRUCTURE IFFStreamCmd,0
  62.         LONG isc_Command     ; Operation to be performed (IFFCMD_)
  63.         APTR isc_Buf         ; Pointer to data buffer
  64.         LONG isc_NBytes      ; Number of bytes to be affected
  65.    LABEL isc_SIZEOF
  66.  
  67. ;---------------------------------------------------------------------------
  68.  
  69. ; A node associated with a context on the iff_Stack. Each node
  70. ; represents a chunk, the stack representing the current nesting
  71. ; of chunks in the open IFF file. Each context node has associated
  72. ; local context items in the (private) LocalItems list. The ID, type,
  73. ; size and scan values describe the chunk associated with this node.
  74. ;
  75. ; This structure can only be allocated by iffparse.library
  76. ;
  77.    STRUCTURE ContextNode,MLN_SIZE
  78.         LONG cn_ID
  79.         LONG cn_Type
  80.         LONG cn_Size         ; Size of this chunk
  81.         LONG cn_Scan         ; # of bytes read/written so far
  82.    LABEL cn_SIZEOF
  83.  
  84. ;---------------------------------------------------------------------------
  85.  
  86. ; Local context items live in the ContextNode's. Each class is identified
  87. ; by its lci_Ident code and has a (private) purge vector for when the
  88. ; parent context node is popped.
  89. ;
  90. ; This structure can only be allocated by iffparse.library
  91. ;
  92.    STRUCTURE LocalContextItem,MLN_SIZE
  93.     ULONG lci_ID
  94.     ULONG lci_Type
  95.     ULONG lci_Ident
  96.    LABEL lci_SIZEOF
  97.  
  98. ;---------------------------------------------------------------------------
  99.  
  100. ; StoredProperty: a local context item containing the data stored
  101. ; from a previously encountered property chunk.
  102. ; NOTE:  ASSEMBLY PREFIX (spr_) DIFFERENT FROM C PREFIX (sp_).
  103. ;
  104.    STRUCTURE StoredProperty,0
  105.     LONG spr_Size
  106.     APTR spr_Data
  107.    LABEL spr_SIZEOF
  108.  
  109. ;---------------------------------------------------------------------------
  110.  
  111. ; Collection Item: the actual node in the collection list at which
  112. ; client will look. The next pointers cross context boundaries so
  113. ; that the complete list is accessable.
  114. ; NOTE:  ASSEMBLY PREFIX (cit_) DIFFERENT FROM C PREFIX (ci_).
  115. ;
  116.    STRUCTURE CollectionItem,0
  117.     APTR cit_Next
  118.     LONG cit_Size
  119.     APTR cit_Data
  120.    LABEL cit_SIZEOF
  121.  
  122. ;---------------------------------------------------------------------------
  123.  
  124. ; Structure returned by OpenClipboard(). You may do CMD_POSTs and such
  125. ; using this structure. However, once you call OpenIFF(), you may not
  126. ; do any more of your own I/O to the clipboard until you call CloseIFF().
  127. ;
  128.    STRUCTURE ClipboardHandle,iocr_SIZEOF   ; cbh_Reg
  129.     STRUCT cbh_CBport,MP_SIZE
  130.     STRUCT cbh_SatisfyPort,MP_SIZE
  131.    LABEL cbh_SIZEOF
  132.  
  133. ;---------------------------------------------------------------------------
  134.  
  135. ; IFF return codes. Most functions return either zero for success or
  136. ; one of these codes. The exceptions are the read/write functions which
  137. ; return positive values for number of bytes or records read or written,
  138. ; or a negative error code. Some of these codes are not errors per sae,
  139. ; but valid conditions such as EOF or EOC (End of Chunk).
  140. ;
  141. IFFERR_EOF      equ -1      ; Reached logical end of file
  142. IFFERR_EOC      equ -2      ; About to leave context
  143. IFFERR_NOSCOPE      equ -3      ; No valid scope for property
  144. IFFERR_NOMEM      equ -4      ; Internal memory alloc failed
  145. IFFERR_READ      equ -5      ; Stream read error
  146. IFFERR_WRITE      equ -6      ; Stream write error
  147. IFFERR_SEEK      equ -7      ; Stream seek error
  148. IFFERR_MANGLED      equ -8      ; Data in file is corrupt
  149. IFFERR_SYNTAX      equ -9      ; IFF syntax error
  150. IFFERR_NOTIFF      equ -10     ; Not an IFF file
  151. IFFERR_NOHOOK      equ -11     ; No call-back hook provided
  152. IFF_RETURN2CLIENT equ -12     ; Client handler normal return
  153.  
  154. ;---------------------------------------------------------------------------
  155.  
  156. ; Universal IFF identifiers
  157. ID_FORM         equ 'FORM'
  158. ID_LIST         equ 'LIST'
  159. ID_CAT             equ 'CAT '
  160. ID_PROP         equ 'PROP'
  161. ID_NULL         equ '    '
  162.  
  163. ; Identifier codes for universally recognized local context items.
  164. IFFLCI_PROP         equ 'prop'
  165. IFFLCI_COLLECTION    equ 'coll'
  166. IFFLCI_ENTRYHANDLER  equ 'enhd'
  167. IFFLCI_EXITHANDLER   equ 'exhd'
  168.  
  169. ;---------------------------------------------------------------------------
  170.  
  171. ; Control modes for ParseIFF() function
  172. IFFPARSE_SCAN     equ 0
  173. IFFPARSE_STEP     equ 1
  174. IFFPARSE_RAWSTEP equ 2
  175.  
  176. ;---------------------------------------------------------------------------
  177.  
  178. ; Control modes for StoreLocalItem() function
  179. IFFSLI_ROOT  equ 1    ; Store in default context
  180. IFFSLI_TOP   equ 2    ; Store in current context
  181. IFFSLI_PROP  equ 3    ; Store in topmost FORM or LIST
  182.  
  183. ;---------------------------------------------------------------------------
  184.  
  185. ; Magic value for writing functions. If you pass this value in as a size
  186. ; to PushChunk() when writing a file, the parser will figure out the
  187. ; size of the chunk for you. If you know the size, is it better to
  188. ; provide as it makes things faster.
  189. ;
  190. IFFSIZE_UNKNOWN equ -1
  191.  
  192. ;---------------------------------------------------------------------------
  193.  
  194. ; Possible call-back command values
  195. ;
  196. IFFCMD_INIT    equ 0    ; Prepare your stream for a session
  197. IFFCMD_CLEANUP    equ 1    ; Terminate stream session
  198. IFFCMD_READ    equ 2    ; Read bytes from stream
  199. IFFCMD_WRITE    equ 3    ; Write bytes to stream
  200. IFFCMD_SEEK    equ 4    ; Seek on stream
  201. IFFCMD_ENTRY    equ 5    ; You just entered a new context
  202. IFFCMD_EXIT    equ 6    ; You're about to leave a context
  203. IFFCMD_PURGELCI equ 7   ; Purge a LocalContextItem
  204.  
  205.  
  206. ;---------------------------------------------------------------------------
  207.  
  208. ; Obsolete IFFParse definitions, here for source code compatibility only.
  209. ; Please do NOT use in new code.
  210. ;
  211. ; Set IFFPARSE_V37_NAMES_ONLY to remove these older names
  212. ;
  213.         IFND IFFPARSE_V37_NAMES_ONLY
  214. IFFSCC_INIT     equ IFFCMD_INIT
  215. IFFSCC_CLEANUP  equ IFFCMD_CLEANUP
  216. IFFSCC_READ     equ IFFCMD_READ
  217. IFFSCC_WRITE    equ IFFCMD_WRITE
  218. IFFSCC_SEEK     equ IFFCMD_SEEK
  219.         ENDC
  220.  
  221. ;---------------------------------------------------------------------------
  222.  
  223.         ENDC    ; LIBRARIES_IFFPARSE_I
  224.